xxxxxxxxxx# Machine Learning Model for the Planetary AlbedoxxxxxxxxxxThe goal of the project is to use machine learning techniques to identify relationships between planetary mapped datasets, with the goal of providing deeper understanding of planetary surfaces and to have predictive power for planetary surfaces with incomplete datasets.The goal of the project is to use machine learning techniques to identify relationships between planetary mapped datasets, with the goal of providing deeper understanding of planetary surfaces and to have predictive power for planetary surfaces with incomplete datasets.
xxxxxxxxxx### Mentors* Patrick Peplowski (JHUAPL)* Sergei Gleyzer (University of Alabama)* Jason Terry (University of Georgiaxxxxxxxxxx # Table of Contents * [Task-1: Predicting the Lunar Albedo of Moon based on Chemical Composition](#task1) * [Data Loading](#dl11) * [Data Wrangling](#dw11) * [Data Preparation](#dp11) * [Applying Machine Learning](#ml11) * [Approach-1: Directly Applying Machine Learning Model](#ap11) * [Best 3 Models](#bm11) * [Approach-2: Applying Machine Learning After Transpose](#ap12) * [Approach-3: Applying Machine Learning After Dividing the Data](#ap13) * [Predicting the Result](#pr11) * [Using Thorium](#th11) * [Using Titanium](#ti11) * [Using Iron](#fe) * [Using Potassium](#k) * [Overall Result of Task-1](#rr11) * [Task-2](#task2) * [Data Loading](#dl21) * [Data Wrangling](#dw21) * [Data Preparation](#dw21) * [Predicting the Result](#pr21) * [alsimap_smooth (Al to Si element ratio)](#alsi) * [casimap_smooth (Ca to Si element ratio)](#casi) * [fesimap_smooth (Fe to Si element ratio)](#fesi) * [mgsimap_smooth (Mg to Si element ratio)](#mgsi) * [ssimap_smooth (S to Si element ratio)](#ssi) * [Overall Result of Task-2](#rr21) * [Problem Faced](#q)xxxxxxxxxx<a id="task1"></a># Task 1. Predicting the Lunar Albedo of Moon based on Chemical CompositionxxxxxxxxxxUsing the data found in ML4SCI_GSoC/Messenger/Moon/, select a subset of the Moons surface to train your model to identify relationship between albedo and composition. Then, make a prediction about the albedo of the untrained portion of the map using just the chemical data.Compare your albedo prediction to the albedo map. How did your algorithm perform? Choose a metric to quantify your performance.Using the data found in ML4SCI_GSoC/Messenger/Moon/, select a subset of the Moons surface to train your model to identify relationship between albedo and composition. Then, make a prediction about the albedo of the untrained portion of the map using just the chemical data.Compare your albedo prediction to the albedo map. How did your algorithm perform? Choose a metric to quantify your performance.
xxxxxxxxxxThe albedo map, LPFe (iron map), LPK (potassium map), LPTh (thorium map), and LPTi (titanium) map should be used for this study. The maps are csv files with data that represents the element concentration at each location. Make sure you can reproducethe maps above to verify you are reading the data correctly.The albedo map, LPFe (iron map), LPK (potassium map), LPTh (thorium map), and LPTi (titanium) map should be used for this study. The maps are csv files with data that represents the element concentration at each location. Make sure you can reproduce the maps above to verify you are reading the data correctly.
xxxxxxxxxx#import librariesimport pandas as pdimport numpy as npimport matplotlib.pyplot as pltimport matplotlib.patches as patchesimport seaborn as sbimport warningsfrom sklearn.model_selection import cross_val_scorefrom sklearn.model_selection import RepeatedKFoldfrom sklearn.metrics import roc_auc_score,r2_score,mean_absolute_error,mean_squared_error,accuracy_score,classification_report,confusion_matrixfrom sklearn.model_selection import train_test_splitfrom sklearn.linear_model import Ridgefrom sklearn.tree import DecisionTreeRegressorfrom sklearn.neighbors import KNeighborsRegressorfrom sklearn.linear_model import Lassofrom sklearn.linear_model import ElasticNetfrom sklearn.ensemble import ExtraTreesRegressorfrom sklearn.ensemble import RandomForestRegressorfrom sklearn.ensemble import AdaBoostRegressorfrom sklearn.multioutput import MultiOutputRegressorwarnings.filterwarnings("ignore")%matplotlib inlinexxxxxxxxxxalbedodf = pd.read_csv('Albedo_Map.csv',header = None)xxxxxxxxxxalbedodf.head(3)xxxxxxxxxxalbedodf.shapexxxxxxxxxxdef plotcolormap(df,title='ColorMap',patch=False): """ This function plot the Lunar of the csv input: df:DataFrame to produce map title:title of the map patch:False/True for showing rectangle patch ouput: return:None """ fig = plt.figure(figsize=(6, 4)) ax = fig.add_subplot(111) ax.set_title(title) ax.set_xlabel("Longitude") ax.set_ylabel("Latitude") if(patch==True): rect = patches.Rectangle((200,50),200,150, edgecolor='r', facecolor="none") ax.add_patch(rect) plt.imshow(df);xxxxxxxxxxplotcolormap(albedodf,'Map of Lunar Albedo of Moon')xxxxxxxxxx#Lunar Prospector of Felpfe = pd.read_csv('LPFe_Map.csv',header = None)plotcolormap(lpfe,'Map of Lunar Prospector of Fe')xxxxxxxxxx#Lunar Prospector of Thlpth = pd.read_csv('LPTh_Map.csv',header = None)plotcolormap(lpth,'Map of Lunar Prospector of Th')xxxxxxxxxx#Lunar Prospector of Tilpti = pd.read_csv('LPTi_Map.csv',header = None)plotcolormap(lpth,'Map of Lunar Prospector of Ti')xxxxxxxxxx#Lunar Prospector of Klpk = pd.read_csv('LPK_Map.csv',header = None)plotcolormap(lpk,'Map of Lunar Prospector of K')xxxxxxxxxxAll the Lunar Prospector of chemical data have a same centralised where region where the concentration is high and infact the lunar albedo of moon also shows high Intensity.All the Lunar Prospector of chemical data have a same centralised where region where the concentration is high and infact the lunar albedo of moon also shows high Intensity.
xxxxxxxxxxplotcolormap(albedodf,'Map of Lunar Albedo of Moon',patch =True)xxxxxxxxxxplotcolormap(lpth,'Map of Lunar Lunar Prospector of Th',patch =True)xxxxxxxxxxplotcolormap(lpti,'Map of Lunar Lunar Prospector of Ti',patch =True)xxxxxxxxxxplotcolormap(lpfe,'Map of Lunar Lunar Prospector of Ti',patch =True)xxxxxxxxxx<b>I choose Thorium as to make prediction about the lunar albedo as these two maps are highly co related and with small dataset thorium will give better results then any other chemical.</b>I choose Thorium as to make prediction about the lunar albedo as these two maps are highly co related and with small dataset thorium will give better results then any other chemical.
xxxxxxxxxxprint(lpth.isnull().sum().sum())print(albedodf.isnull().sum().sum())xxxxxxxxxxprint(lpth.values.max())print(lpth.values.min())xxxxxxxxxxprint(albedodf.values.max())print(albedodf.values.min())xxxxxxxxxxi used Scaling to Normalize the Between [0,1]i used Scaling to Normalize the Between [0,1]
xxxxxxxxxx#Scaling values between [0,1]def min_max_scaling(df): """It scales every value of dataframe between[0,1] input:Dataframe return:None """ for column in df.columns: df[column] = (df[column] - df[column].min()) / (df[column].max() - df[column].min()) print("Current max value: ",df.values.max()) print("Current min value: ",df.values.min())min_max_scaling(lpth)min_max_scaling(albedodf)xxxxxxxxxx<a id="ap11"></a>### Approach 1 : Directly Applying Machine Learning ModelxxxxxxxxxxIn this Approach i used the Scaled dataset to make prediction and i have used 8 Models for this:* Ridge Regressor* DecisionTreeRegressor* KNeighborsRegressor* Lasso Regressor* ElasticNet Regressor* ExtraTreesRegressor* RandomForestRegressor* AdaBoostRegressorIn this Approach i used the Scaled dataset to make prediction and i have used 8 Models for this:
xxxxxxxxxxX_train, X_test, y_train, y_test = train_test_split(lpth, albedodf, test_size=0.3, random_state=42)xxxxxxxxxxdef evaluate_model(model,X_train=X_train,y_train=y_train,X_test=X_test,y_test=y_test): """ This function take Regressor model as input, fit the model , gives the r2 score,mean Squared Error and Mean Absolute Error and return predictions. input: model:the regressor X_train: Albedo training data y_train: Chemical training data X_test: Albedo testing data y_test: Chemical testing data return:predictions """ #fit the model model.fit(X_train,y_train) #prediction from the model pred = model.predict(X_test) #score of models r2score = r2_score(y_test,pred) mse =mean_squared_error(y_test,pred) mae =mean_absolute_error(y_test,pred) print('The r-squared score of the model is ',r2score) print('The mean squared error is',mse) print('The mean absolute error is',mae) return predxxxxxxxxxxreg = Ridge(alpha=1.0)evaluate_model(reg)xxxxxxxxxxreg = DecisionTreeRegressor()evaluate_model(reg)xxxxxxxxxxreg = KNeighborsRegressor()evaluate_model(reg)xxxxxxxxxxreg = Lasso()evaluate_model(reg)xxxxxxxxxxreg = MultiOutputRegressor(ElasticNet())evaluate_model(reg)xxxxxxxxxxreg = ExtraTreesRegressor()evaluate_model(reg)xxxxxxxxxxreg = RandomForestRegressor()evaluate_model(reg)xxxxxxxxxxreg = MultiOutputRegressor(AdaBoostRegressor(n_estimators=10))evaluate_model(reg)xxxxxxxxxxThe 3 best models out of 8:* RandomForestRegressor r2score:0.8241* Ridge Regressor r2score:0.8206* DecisionTreeRegressor r2score:0.8111The 3 best models out of 8:
xxxxxxxxxxprint("Random Forest Regressor")#initalize the modelreg = RandomForestRegressor()#getting predictions y_pred = evaluate_model(reg)#append training data to get full imageprediction = y_train.append(pd.DataFrame(y_pred)).sort_index()original = y_train.append(pd.DataFrame(y_test)).sort_index()#ploting the full imageplotcolormap(prediction,'Predicted map of Random forest regressor')plotcolormap(original,'Original map of Random forest regressor')xxxxxxxxxxprint("Ridge Regressor")#initalize the modelreg = Ridge(alpha=1.0)#getting predictions y_pred = evaluate_model(reg)#append training data to get full imageprediction = y_train.append(pd.DataFrame(y_pred)).sort_index()original = y_train.append(pd.DataFrame(y_test)).sort_index()#ploting the full imageplotcolormap(prediction,'Predicted map of Ridge regressor')plotcolormap(original,'Original map of Ridge regressor')xxxxxxxxxxprint("Decision Tree Regressor")#initalize the modelreg = DecisionTreeRegressor()#getting predictions y_pred = evaluate_model(reg)#append training data to get full imageprediction = y_train.append(pd.DataFrame(y_pred)).sort_index()original = y_train.append(pd.DataFrame(y_test)).sort_index()#ploting the full imageplotcolormap(prediction,'Predicted map of Decision Tree regressor')plotcolormap(original,'Original map of Decision Tree regressor')xxxxxxxxxx<b>As we have scaled the data that's why are original data has changed.These three Regressor have almost same output.</b>As we have scaled the data that's why are original data has changed.These three Regressor have almost same output.
xxxxxxxxxx<a id="ap12"></a>### Approach-2 : Applying Machine Learning After TransposexxxxxxxxxxAs the features are not actually features these are length so i transpose the data while training the Machine Learning and While creating maps i will transpose them again.* Not doing the Scaling this time just the original dataset.* Using the Previous Best three modelAs the features are not actually features these are length so i transpose the data while training the Machine Learning and While creating maps i will transpose them again.
xxxxxxxxxxlpth = pd.read_csv('LPTh_Map.csv',header = None)albedodf = pd.read_csv('Albedo_Map.csv',header = None)xxxxxxxxxxprint("Previous Shape: ",lpth.shape)lpth = lpth.transpose()print("New Shape:",lpth.shape)xxxxxxxxxxprint("Previous Shape: ",albedodf.shape)albedodf = albedodf.transpose()print("New Shape:",albedodf.shape)xxxxxxxxxxX_train, X_test, y_train, y_test = train_test_split(lpth, albedodf, test_size=0.3, random_state=42)xxxxxxxxxxprint("Ridge Regressor")#initalize the modelreg = Ridge(alpha=1.0)#getting predictionsy_pred = evaluate_model(reg,X_train,y_train,X_test,y_test)#append training data to get full imageprediction = y_train.append(pd.DataFrame(y_pred)).sort_index()original = y_train.append(pd.DataFrame(y_test)).sort_index()#ploting the full imageplotcolormap(prediction.transpose(),'Predicted map of Ridge regressor')plotcolormap(original.transpose(),'Original map of Ridge regressor')xxxxxxxxxxprint("Random Forest Regressor")#initalize the modelreg = RandomForestRegressor(random_state=42)#getting predictionsy_pred = evaluate_model(reg,X_train,y_train,X_test,y_test)#append training data to get full imageprediction = y_train.append(pd.DataFrame(y_pred)).sort_index()original = y_train.append(pd.DataFrame(y_test)).sort_index()#ploting the full imageplotcolormap(prediction.transpose(),'Predicted map of Random Forest regressor')plotcolormap(original.transpose(),'Original map of Random Forest regressor')xxxxxxxxxxprint("Decision Tree Regressor")#initalize the modelreg = DecisionTreeRegressor()#getting predictionsy_pred = evaluate_model(reg,X_train,y_train,X_test,y_test)#append training data to get full imageprediction = y_train.append(pd.DataFrame(y_pred)).sort_index()original = y_train.append(pd.DataFrame(y_test)).sort_index()#ploting the full imageplotcolormap(prediction.transpose(),'Predicted map of Decision Tree regressor')plotcolormap(original.transpose(),'Original map of Decision Tree regressor')xxxxxxxxxx<a id="ap13"></a>### Approach-3: Applying Machine Learning After Dividing the DataxxxxxxxxxxIn this Approach i will divide the Longitude in pieces and then combine the Overall Result.In this Approach i will divide the Longitude in pieces and then combine the Overall Result.
xxxxxxxxxxlpth = pd.read_csv('LPTh_Map.csv',header = None)albedodf = pd.read_csv('Albedo_Map.csv',header = None)xxxxxxxxxxlpth = lpth.iloc[:,:50]albedodf = albedodf.iloc[:,:50]xxxxxxxxxxprint(lpth.shape)print(albedodf.shape)xxxxxxxxxxX_train, X_test, y_train, y_test = train_test_split(lpth, albedodf, test_size=0.3, random_state=42)xxxxxxxxxxprint("Random Forest Regressor")#initalize the modelreg = RandomForestRegressor(random_state=42)#getting predictionsy_pred = evaluate_model(reg,X_train,y_train,X_test,y_test)#append training data to get full imageprediction = y_train.append(pd.DataFrame(y_pred)).sort_index()original = y_train.append(pd.DataFrame(y_test)).sort_index()#ploting the full imageplotcolormap(prediction.transpose(),'Predicted map of Random Forest regressor')plotcolormap(original.transpose(),'Original map of Random Forest regressor')xxxxxxxxxxprint("Ridge Regressor")#initalize the modelreg = Ridge(alpha=1.0)#getting predictionsy_pred = evaluate_model(reg,X_train,y_train,X_test,y_test)#append training data to get full imageprediction = y_train.append(pd.DataFrame(y_pred)).sort_index()original = y_train.append(pd.DataFrame(y_test)).sort_index()#ploting the full imageplotcolormap(prediction.transpose(),'Predicted map of Ridge Regressor')plotcolormap(original.transpose(),'Original map of Ridge Regressor')xxxxxxxxxxprint("Decision Tree Regressor")#initalize the modelreg = DecisionTreeRegressor()#getting predictionsy_pred = evaluate_model(reg,X_train,y_train,X_test,y_test)#append training data to get full imageprediction = y_train.append(pd.DataFrame(y_pred)).sort_index()original = y_train.append(pd.DataFrame(y_test)).sort_index()#ploting the full imageplotcolormap(prediction.transpose(),'Predicted map of Decision Tree Regressor')plotcolormap(original.transpose(),'Original map of Decision Tree Regressor')xxxxxxxxxxThere is no such large Effect on performance (r2-score) so i am not going forward in this Approach.There is no such large Effect on performance (r2-score) so i am not going forward in this Approach.
xxxxxxxxxx<a id="pr11"></a>## Predicting the ResultRandom forest Regressor found to best and the best resulting image is when we transpose the give image to the machine Learning then retranspose it to get the required result.The best model has an r2 score of 0.8912.Random forest Regressor found to best and the best resulting image is when we transpose the give image to the machine Learning then retranspose it to get the required result.The best model has an r2 score of 0.8912.
xxxxxxxxxxdef plot_histogram(y_pred,y_test,title=''): """ It plots the histogram and shows the difference of Original Image and Predicted Image. input: y_pred : prediction of Pixel values y_test: Original Pixel values title : title of the plot output: return: None """ pred_diff = (y_pred - y_test).to_numpy().flatten() hist, bin_edges = np.histogram(pred_diff); plt.hist(pred_diff, bins='auto'); plt.xlabel("Difference in Prediction") plt.ylabel("Number of Features") plt.title("Prediction Result Difference from Original in "+str(title))xxxxxxxxxx#reading the datalpth = pd.read_csv('LPTh_Map.csv',header = None)albedodf = pd.read_csv('Albedo_Map.csv',header = None)#Transposing the dataprint("Previous Shape: ",lpth.shape)lpth = lpth.transpose()print("New Shape:",lpth.shape)print("Previous Shape: ",albedodf.shape)albedodf = albedodf.transpose()print("New Shape:",albedodf.shape)#Splitting the dataX_train, X_test, y_train, y_test = train_test_split(lpth, albedodf, test_size=0.3, random_state=42)#initialize the modelreg = RandomForestRegressor(random_state=42)#getting predictionsy_pred = evaluate_model(reg,X_train,y_train,X_test,y_test)#append training data to get full imageprediction = y_train.append(pd.DataFrame(y_pred)).sort_index()original = y_train.append(pd.DataFrame(y_test)).sort_index()#ploting the full imageplotcolormap(prediction.transpose(),'Predicted Lunar Prospector of Thorium')plotcolormap(original.transpose(),'Original Lunar Prospector of Thorium')xxxxxxxxxxplot_histogram(y_pred,y_test,'Thorium')xxxxxxxxxx#reading the datalpth = pd.read_csv('LPTi_Map.csv',header = None)albedodf = pd.read_csv('Albedo_Map.csv',header = None)#Transposing the dataprint("Previous Shape: ",lpth.shape)lpth = lpth.transpose()print("New Shape:",lpth.shape)print("Previous Shape: ",albedodf.shape)albedodf = albedodf.transpose()print("New Shape:",albedodf.shape)#Splitting the dataX_train, X_test, y_train, y_test = train_test_split(lpth, albedodf, test_size=0.3, random_state=42)#initialize the modelreg = RandomForestRegressor(random_state=42)#getting predictionsy_pred = evaluate_model(reg,X_train,y_train,X_test,y_test)#append training data to get full imageprediction = y_train.append(pd.DataFrame(y_pred)).sort_index()original = y_train.append(pd.DataFrame(y_test)).sort_index()#ploting the full imageplotcolormap(prediction.transpose(),'Predicted Lunar Prospector of Titanium')plotcolormap(original.transpose(),'Original Lunar Prospector of Titanium')xxxxxxxxxxplot_histogram(y_pred,y_test,'in Titanium')xxxxxxxxxx#reading the datalpth = pd.read_csv('LPFe_Map.csv',header = None)albedodf = pd.read_csv('Albedo_Map.csv',header = None)#Transposing the dataprint("Previous Shape: ",lpth.shape)lpth = lpth.transpose()print("New Shape:",lpth.shape)print("Previous Shape: ",albedodf.shape)albedodf = albedodf.transpose()print("New Shape:",albedodf.shape)#Splitting the dataX_train, X_test, y_train, y_test = train_test_split(lpth, albedodf, test_size=0.3, random_state=42)#initialize the modelreg = RandomForestRegressor(random_state=42)#getting predictionsy_pred = evaluate_model(reg,X_train,y_train,X_test,y_test)#append training data to get full imageprediction = y_train.append(pd.DataFrame(y_pred)).sort_index()original = y_train.append(pd.DataFrame(y_test)).sort_index()#ploting the full imageplotcolormap(prediction.transpose(),'Predicted Lunar Prospector of Iron')plotcolormap(original.transpose(),'Original Lunar Prospector of Iron')xxxxxxxxxxplot_histogram(y_pred,y_test,'in Iron')xxxxxxxxxx#reading the datalpth = pd.read_csv('LPK_Map.csv',header = None)albedodf = pd.read_csv('Albedo_Map.csv',header = None)#Transposing the dataprint("Previous Shape: ",lpth.shape)lpth = lpth.transpose()print("New Shape:",lpth.shape)print("Previous Shape: ",albedodf.shape)albedodf = albedodf.transpose()print("New Shape:",albedodf.shape)#Splitting the dataX_train, X_test, y_train, y_test = train_test_split(lpth, albedodf, test_size=0.3, random_state=42)#initialize the modelreg = RandomForestRegressor(random_state=42)#getting predictionsy_pred = evaluate_model(reg,X_train,y_train,X_test,y_test)#append training data to get full imageprediction = y_train.append(pd.DataFrame(y_pred)).sort_index()original = y_train.append(pd.DataFrame(y_test)).sort_index()#ploting the full imageplotcolormap(prediction.transpose(),'Predicted Lunar Prospector of Potassium')plotcolormap(original.transpose(),'Original Lunar Prospector of Potassium')xxxxxxxxxxplot_histogram(y_pred,y_test,'in Potassium')xxxxxxxxxx* The Random Forest Algorithm perform pretty well for this task.I am getting Average r2 score of 0.8862 and Average mean squared error of 0.000179.* There are some in noise in the prediction will be removed if we train our Machine Learning Algorithm on Larger dataset.xxxxxxxxxx<a id="task2"></a># TASK2The MESSENGER spacecraft mapped Mercury’s surface from 2011 to 2015, including making full-surface albedo maps and partial element maps.For Mercury the albedo map is split into the top and bottom of the planet (mercury-albedo-top-half.png.csv and mercury-albedo_resized_botton-half.png.csv).Train your model on the top half. Training should attempt to identify relationshipsbetween albedo and chemistry. Chemical maps are:* alsimap_smooth (Al to Si element ratio),* casimap_smooth (Ca to Si element ratio),* fesimap_smooth (Fe to Si element ratio),* mgsimap_smooth (Mg to Si element ratio),* ssimap_smooth (S to Si element ratio),Then, make a prediction about chemical composition for the bottom half of the planet using the albedo Compare your albedo prediction to the albedo map. How did your algorithm perform? Choose a metric to quantify your performance.The MESSENGER spacecraft mapped Mercury’s surface from 2011 to 2015, including making full-surface albedo maps and partial element maps.For Mercury the albedo map is split into the top and bottom of the planet (mercury-albedo-top-half.png.csv and mercury-albedo_resized_botton-half.png.csv).Train your model on the top half. Training should attempt to identify relationships between albedo and chemistry. Chemical maps are:
Then, make a prediction about chemical composition for the bottom half of the planet using the albedo Compare your albedo prediction to the albedo map. How did your algorithm perform? Choose a metric to quantify your performance.
xxxxxxxxxxalbedo_top = pd.read_csv('mercury-albedo-top-half.png.csv',header=None)plotcolormap(albedo_top,'Mercury top Lunar Albedo')xxxxxxxxxxalbedo_bottom = pd.read_csv('mercury-albedo-resized-bottom-half.png.csv',header=None)plotcolormap(albedo_bottom,'Mercury Bottom Lunar Albedo')xxxxxxxxxxalsi_df = pd.read_csv('alsimap_smooth_032015.png.csv',header=None)plotcolormap(alsi_df)xxxxxxxxxxcasi_df = pd.read_csv('casimap_smooth_032015.png.csv',header=None)plotcolormap(casi_df,'Ca to Si element ratio Lunar Prospector')xxxxxxxxxxfesi_df = pd.read_csv('fesimap_smooth_032015.png.csv',header=None)plotcolormap(fesi_df,'Fe to Si element ratio Lunar Prospector')xxxxxxxxxxmgsi_df = pd.read_csv('mgsimap_smooth_032015.png.csv',header=None)plotcolormap(mgsi_df,'Mg to Si element ratio Lunar Prospector')xxxxxxxxxxssi_df = pd.read_csv('ssimap_smooth_032015.png.csv',header=None)plotcolormap(ssi_df,'S to Si element ratio Lunar Prospector')xxxxxxxxxxUnlike the moon albedo where we are able to see the co-releation betwwen Lunar Albedo and Chemical maps there are no direct co-relation in these maps but casimap_smooth (Ca to Si element ratio), fesimap_smooth (Fe to Si element ratio),ssimap_smooth (S to Si element ratio) are very much releated to one other.Unlike the moon albedo where we are able to see the co-releation betwwen Lunar Albedo and Chemical maps there are no direct co-relation in these maps but casimap_smooth (Ca to Si element ratio), fesimap_smooth (Fe to Si element ratio),ssimap_smooth (S to Si element ratio) are very much releated to one other.
xxxxxxxxxx<a id="pr21"></a>## Applying Machine Learing and Predicting the ResultIn this task i am directly using the Transpose Approach with KNeighborsRegressor which perform pretty well on this data compare to others.In this task i am directly using the Transpose Approach with KNeighborsRegressor which perform pretty well on this data compare to others.
xxxxxxxxxxalbedo_top = pd.read_csv('mercury-albedo-top-half.png.csv',header=None)plotcolormap(albedo_top,'Mercury Albedo of top-half')xxxxxxxxxx<a id="alsi"></a>### Using alsimap_smooth (Al to Si element ratio)xxxxxxxxxx#transposing the dataprint("Previous Shape: ",albedo_top.shape)albedo_top = albedo_top.transpose()print("New Shape:",albedo_top.shape)print("Previous Shape: ",alsi_df.shape)alsi_df = alsi_df.transpose()print("New Shape:",alsi_df.shape)#initialize the modelclf = KNeighborsRegressor()clf.fit(albedo_top,alsi_df)#getting predictionsy_pred = clf.predict(albedo_bottom.transpose())#color map of predictionsplotcolormap(y_pred.transpose(),'alsi Predicted Map')plotcolormap(alsi_df.transpose(),'alsi Original Map used for Training')xxxxxxxxxx<a id="casi"></a>### Using casimap_smooth (Ca to Si element ratio)xxxxxxxxxx#transposing the dataprint("Previous Shape: ",casi_df.shape)casi_df = casi_df.transpose()print("New Shape:",casi_df.shape)#initialize the modelclf = KNeighborsRegressor()clf.fit(albedo_top,casi_df)#getting predictionsy_pred = clf.predict(albedo_bottom.transpose())#color map of predictionsplotcolormap(y_pred.transpose(),'casi Predicted Map')plotcolormap(casi_df.transpose(),'casi Original Map used for Training')xxxxxxxxxx<a id="fesi"></a>### Using fesimap_smooth (Fe to Si element ratio)xxxxxxxxxx#transposing the dataprint("Previous Shape: ",fesi_df.shape)fesi_df = fesi_df.transpose()print("New Shape:",fesi_df.shape)#initialize the modelclf = KNeighborsRegressor()clf.fit(albedo_top,fesi_df)#getting predictionsy_pred = clf.predict(albedo_bottom.transpose())#color map of predictionsplotcolormap(y_pred.transpose(),'fesi Predicted Map')plotcolormap(fesi_df.transpose(),'fesi Original Map used for Training')xxxxxxxxxx<a id="mgsi"></a>### Using mgsimap_smooth (Mg to Si element ratio)xxxxxxxxxx#transposing the dataprint("Previous Shape: ",mgsi_df.shape)mgsi_df = mgsi_df.transpose()print("New Shape:",mgsi_df.shape)#initialize the modelclf = KNeighborsRegressor()clf.fit(albedo_top,mgsi_df)#getting predictionsy_pred = clf.predict(albedo_bottom.transpose())#color map of predictionsplotcolormap(y_pred.transpose(),'mgsi Predicted Map')plotcolormap(mgsi_df.transpose(),'mgsi Original Map used for Training')xxxxxxxxxx<a id="ssi"></a>### Using ssimap_smooth (S to Si element ratio)xxxxxxxxxx#transposing the dataprint("Previous Shape: ",ssi_df.shape)ssi_df = ssi_df.transpose()print("New Shape:",ssi_df.shape)#initialize the modelclf = KNeighborsRegressor()clf.fit(albedo_top,ssi_df)#getting predictionsy_pred = clf.predict(albedo_bottom.transpose())#color map of predictionsplotcolormap(y_pred.transpose(),'ssi Predicted Map')plotcolormap(mgsi_df.transpose(),'ssi Original Map used for Training')xxxxxxxxxxMaps Produce in this Task are not very great but it will improve by using larger dataset.Perfomance Measurement for Task-2 can't be done because i have used chemical map,albedo top for training as given in the first part.So i don't have anything to compare with.If the bottom chemical composition is available then only i can measure the performance.Maps Produce in this Task are not very great but it will improve by using larger dataset.Perfomance Measurement for Task-2 can't be done because i have used chemical map,albedo top for training as given in the first part.So i don't have anything to compare with.If the bottom chemical composition is available then only i can measure the performance.
xxxxxxxxxxDataset was available in Limited Quantity so the Machine Learning Algorithms are not able to predict better.Dataset was available in Limited Quantity so the Machine Learning Algorithms are not able to predict better.
xxxxxxxxxxI have some difficulty in Understanding the tasks and especially in task-2 i don't have true images to compare performance.I have some difficulty in Understanding the tasks and especially in task-2 i don't have true images to compare performance.
xxxxxxxxxxThere is still room for improvement like using K-Fold,Hyper Parameter Tuning and Ensemble Regressor but these techniques takes a lot of time in training time.Neural Networks can also be used for this but i need larger dataset for that.There is still room for improvement like using K-Fold,Hyper Parameter Tuning and Ensemble Regressor but these techniques takes a lot of time in training time.Neural Networks can also be used for this but i need larger dataset for that.